import * as types from '../types'

const state = {
  id: '',
  nick: '',
  avatar: '',
  xufei: false,
  vipExpiretime: ''
}

const mutations = {
  [types.USER_INFO] (state, data) {
    if (undefined !== data.id) {
      state.id = data.id
    }
    if (undefined !== data.nick) {
      state.nick = data.nick
    }
    if (undefined !== data.avatar) {
      state.avatar = data.avatar
    }
    if (undefined !== data.xufei) {
      state.xufei = data.xufei
    }
    if (undefined !== data.vipExpiretime) {
      state.vipExpiretime = data.vipExpiretime
    }
  }
}

export default {
  state,
  mutations
}
